home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-02-22 | 75.3 KB | 2,962 lines |
- diff --context --new-file --recursive ../tcsh-6.02/Makefile ./Makefile
- *** ../tcsh-6.02/Makefile Wed May 20 04:00:52 1992
- --- ./Makefile Sun Feb 21 01:39:52 1993
- ***************
- *** 7,12 ****
- --- 7,16 ----
- # With an input editor, command completion, etc. and ported to all sorts of
- # things; Paul Placeway, CIS Dept., Ohio State University
- #
- +
- + CROSSDIR = /usr/users1/mat91/mh1/atari/cross-gcc
- + CROSSBIN = $(CROSSDIR)/bin
- +
- SHELL=/bin/sh
- VERSION=6.02
- BUILD=tcsh
- ***************
- *** 43,55 ****
-
- # gcc 2.0
- # On the sparc, don't use -O2; it breaks setjmp() and vfork()
- ! CFLAGS=-O $(INCLUDES)
-
- # gcc-2.1
- ! CFLAGS=-O2 $(INCLUDES)
-
- # gcc 2.0+ on linux
- ! #CFLAGS=-O6 $(INCLUDES) -finline-functions -fstrength-reduce
-
- #hpux 8.0
- #CFLAGS= $(INCLUDES) +O3 -Aa
- --- 47,60 ----
-
- # gcc 2.0
- # On the sparc, don't use -O2; it breaks setjmp() and vfork()
- ! #CFLAGS=-O $(INCLUDES)
-
- # gcc-2.1
- ! #CFLAGS=-O2 $(INCLUDES)
-
- # gcc 2.0+ on linux
- ! # MiNT
- ! CFLAGS=-O6 -mbaserel $(INCLUDES) -finline-functions -fstrength-reduce -DNO_CRYPT
-
- #hpux 8.0
- #CFLAGS= $(INCLUDES) +O3 -Aa
- ***************
- *** 106,112 ****
- ################################################################
- ## LIBES. Pick one, or roll your own.
- ################################################################
- ! LIBES= -ltermcap ## BSD style things, hpux
- #LIBES= -ltermcap -lcs ## Mach
- #LIBES= -lcurses ## Sys V3 w/o networking (and Sys V4)
- #LIBES= -lcurses -lc /usr/ucblib/libucb.a ## Sys V4 with BSDTIMES
- --- 111,117 ----
- ################################################################
- ## LIBES. Pick one, or roll your own.
- ################################################################
- ! #LIBES= -ltermcap ## BSD style things, hpux
- #LIBES= -ltermcap -lcs ## Mach
- #LIBES= -lcurses ## Sys V3 w/o networking (and Sys V4)
- #LIBES= -lcurses -lc /usr/ucblib/libucb.a ## Sys V4 with BSDTIMES
- ***************
- *** 136,142 ****
- #LIBES= -lcurses -lnsl -lsocket -lc /usr/ucblib/libucb.a ## Stardent Vistra
- #LIBES= -ltermcap -lndir -lsocket -ljobs ## masscomp RTU6.0
- #LIBES= -ltermcap -lauth ## for Ultrix with Enhanced Security
- !
-
-
- # The difficult choice of a c-compiler...
- --- 141,147 ----
- #LIBES= -lcurses -lnsl -lsocket -lc /usr/ucblib/libucb.a ## Stardent Vistra
- #LIBES= -ltermcap -lndir -lsocket -ljobs ## masscomp RTU6.0
- #LIBES= -ltermcap -lauth ## for Ultrix with Enhanced Security
- ! LIBES= -lbtermcap ## when compiling with -mbaserel in MiNT
-
-
- # The difficult choice of a c-compiler...
- ***************
- *** 146,151 ****
- --- 151,157 ----
- # If you want to take out -traditional, make sure that your sys/ioctl.h
- # is fixed correctly, otherwise you'll be stopped for tty input, or you
- # will lose the editor and job control.
- + #CC= $(CROSSBIN)/cgcc -Wall
- CC= gcc -Wall
- #CC= cc
- #CC= occ
- diff --context --new-file --recursive ../tcsh-6.02/config.h ./config.h
- *** ../tcsh-6.02/config.h
- --- ./config.h Sun Feb 21 01:39:54 1993
- ***************
- *** 0 ****
- --- 1,114 ----
- + /*
- + * config.h -- configure various defines for tcsh
- + *
- + * All source files should #include this FIRST.
- + *
- + * Edit this to match your system type.
- + */
- +
- + #ifndef __MINT__
- + #define __MINT__
- + #endif
- +
- + /****************** System dependant compilation flags ****************/
- + /*
- + * POSIX This system supports IEEE Std 1003.1-1988 (POSIX).
- + */
- + #undef POSIX
- +
- + /*
- + * POSIXJOBS This system supports the optional IEEE Std 1003.1-1988 (POSIX)
- + * job control facilities.
- + */
- + #undef POSIXJOBS
- +
- + /*
- + * VFORK This machine has a vfork().
- + * It used to be that for job control to work, this define
- + * was mandatory. This is not the case any more.
- + * If you think you still need it, but you don't have vfork,
- + * define this anyway and then do #define vfork fork.
- + * I do this anyway on a Sun because of yellow pages brain damage,
- + * [should not be needed under 4.1]
- + * and on the iris4d cause SGI's fork is sufficiently "virtual"
- + * that vfork isn't necessary. (Besides, SGI's vfork is weird).
- + * Note that some machines eg. rs6000 have a vfork, but not
- + * with the berkeley semantics, so we cannot use it there either.
- + */
- + #define VFORK
- +
- + /*
- + * BSDJOBS You have BSD-style job control (both process groups and
- + * a tty that deals correctly
- + */
- + #define BSDJOBS
- +
- + /*
- + * BSDSIGS You have 4.2-style signals, rather than USG style.
- + * Note: POSIX systems should not define this unless they
- + * have sigvec() and friends (ie: 4.3BSD-RENO, HP-UX).
- + */
- + #define BSDSIGS
- +
- + /*
- + * BSDTIMES You have BSD-style process time stuff (like rusage)
- + * This may or may not be true. For example, Apple Unix
- + * (OREO) has BSDJOBS and BSDSIGS but not BSDTIMES.
- + */
- + #define BSDTIMES
- +
- + /*
- + * BSDNICE Your system uses setpriority() instead of nice, to
- + * change a processes scheduling priority
- + */
- + #undef BSDNICE
- +
- + /*
- + * TERMIO You have struct termio instead of struct sgttyb.
- + * This is usually the case for SYSV systems, where
- + * BSD uses sgttyb. POSIX systems should define this
- + * anyway, even though they use struct termios.
- + */
- + #undef TERMIO
- +
- + /*
- + * SYSVREL Your machine is SYSV based (HPUX, A/UX)
- + * NOTE: don't do this if you are on a Pyramid -- tcsh is
- + * built in a BSD universe.
- + * Set SYSVREL to 1, 2, 3, or 4, depending the version of System V
- + * you are running. Or set it to 0 if you are not SYSV based
- + */
- + #define SYSVREL 0
- +
- + /*
- + * YPBUGS Work around Sun YP bugs that cause expansion of ~username
- + * to send command output to /dev/null
- + */
- + #undef YPBUGS
- +
- + /*
- + * SIGVOID Define this if your signal handlers return void. On older
- + * systems, signal returns int, but on newer ones, it returns void.
- + */
- + #define SIGVOID
- +
- + /*
- + * HAVEDUP2 Define this if your system supports dup2().
- + */
- + #define HAVEDUP2
- +
- + /*
- + * UTHOST Does the utmp file have a host field?
- + */
- + #define UTHOST
- +
- + /*
- + * DIRENT Your system has <dirent.h> instead of <sys/dir.h>
- + */
- + #define DIRENT
- + /****************** local defines *********************/
- + /****************** configurable hacks ****************/
- + /* have been moved to config_f.h */
- + #include "config_f.h"
- +
- + #undef NLS
- diff --context --new-file --recursive ../tcsh-6.02/config_f.h ./config_f.h
- *** ../tcsh-6.02/config_f.h Wed May 20 04:00:52 1992
- --- ./config_f.h Sun Feb 21 01:39:46 1993
- ***************
- *** 95,101 ****
- * on the name of the tty, and environment.
- * Does not make sense in the modern window systems!
- */
- ! #define AUTOLOGOUT
-
- /*
- * SUSPENDED Newer shells say 'Suspended' instead of 'Stopped'.
- --- 95,101 ----
- * on the name of the tty, and environment.
- * Does not make sense in the modern window systems!
- */
- ! #undef AUTOLOGOUT
-
- /*
- * SUSPENDED Newer shells say 'Suspended' instead of 'Stopped'.
- ***************
- *** 117,122 ****
- --- 117,133 ----
- */
- #undef SYSMALLOC
-
- + /*
- + * DOSFS Support DOS filessystems (which have a 12345678.123 limit),
- + * and allow backslashes as path separators
- + */
- + #define DOSFS
- +
- + /*
- + * DOSTEXT Support DOS text mode/files (ignore ^D)
- + */
- + #define DOSTEXT
- +
- /*
- * RCSID This defines if we want rcs strings in the binary or not
- *
- diff --context --new-file --recursive ../tcsh-6.02/ed.init.c ./ed.init.c
- *** ../tcsh-6.02/ed.init.c Wed May 20 04:00:46 1992
- --- ./ed.init.c Sun Feb 21 01:39:22 1993
- ***************
- *** 624,630 ****
- --- 624,648 ----
- char buf[BUFSIZE];
-
- chrs = read(SHIN, buf, (size_t) min(chrs, BUFSIZE - 1));
- +
- + # ifdef DOSTEXT
- + /* strip out carriage returns */
- if (chrs > 0) {
- + char *src, *dst;
- + int i;
- +
- + src = dst = buf;
- + for (i = chrs; i > 0; --i) {
- + if (*src == '\r')
- + --chrs;
- + else
- + *dst++ = *src;
- + src++;
- + }
- + }
- + # endif
- +
- + if (chrs > 0) {
- buf[chrs] = '\0';
- Input_Line = Strsave(str2short(buf));
- PushMacro(Input_Line);
- diff --context --new-file --recursive ../tcsh-6.02/ed.inputl.c ./ed.inputl.c
- *** ../tcsh-6.02/ed.inputl.c Wed May 20 04:00:46 1992
- --- ./ed.inputl.c Sun Feb 21 01:39:24 1993
- ***************
- *** 91,97 ****
- --- 91,102 ----
- if (!Tty_raw_mode && MacroLvl < 0) {
- long chrs = 0;
-
- + # ifndef __MINT__
- + /* MiNT _always_ wants to go into raw mode, so don't bother with the
- + * FIONREAD test
- + */
- (void) ioctl(SHIN, FIONREAD, (ioctl_t) & chrs);
- + # endif
- if (chrs == 0) {
- if (Rawmode() < 0)
- return 0;
- diff --context --new-file --recursive ../tcsh-6.02/pathnames.h ./pathnames.h
- *** ../tcsh-6.02/pathnames.h Wed May 20 04:00:52 1992
- --- ./pathnames.h Sun Feb 21 01:39:46 1993
- ***************
- *** 54,59 ****
- --- 54,65 ----
- # define _PATH_DOTCSHRC "/etc/cshrc"
- #endif /* convex || __convex__ || stellar || INTEL */
-
- + #ifdef DOSFS
- + # define _PATH_DOTLOGIN "/etc/login.csh"
- + # define _PATH_DOTLOGOUT "/etc/logout.csh"
- + # define _PATH_DOTCSHRC "/etc/cshrc.csh"
- + #endif
- +
- #if defined(sgi) || defined(OREO) || defined(cray) || defined(AMIX)
- # define _PATH_DOTLOGIN "/etc/cshrc"
- #endif /* sgi || OREO || cray || AMIX */
- diff --context --new-file --recursive ../tcsh-6.02/sh.c ./sh.c
- *** ../tcsh-6.02/sh.c Wed May 20 04:00:38 1992
- --- ./sh.c Sun Feb 21 01:38:50 1993
- ***************
- *** 124,129 ****
- --- 124,134 ----
- static void mailchk __P((void));
- static Char **defaultpath __P((void));
-
- + #ifdef __MINT__
- + static Char **defaultsuffixes __P((void));
- + void importsuffixes __P((Char *));
- + #endif
- +
- int
- main(argc, argv)
- int argc;
- ***************
- *** 216,221 ****
- --- 221,237 ----
- tempv[1][0] == '-' && tempv[1][1] == 'l' &&
- tempv[1][2] == '\0');
- #endif
- +
- + #ifdef __MINT__
- + /* under MiNT, we're also a login shell if we ran from the desktop and
- + * have no arguments
- + */
- + if (!loginsh && tempv[0][0] == 0 && !tempv[1]) {
- + loginsh = 1;
- + tempv[0] = "-tcsh";
- + }
- + #endif
- +
- if (loginsh && **tempv != '-') {
- /*
- * Mangle the argv space
- ***************
- *** 502,507 ****
- --- 518,533 ----
- else
- importpath(SAVE(tcp));
-
- + #ifdef __MINT__
- + /*
- + * set the suffix search list
- + */
- + if ((tcp = getenv("SUFFIXES")) == NULL)
- + set1(STRsuffixes, defaultsuffixes(), &shvhed);
- + else
- + importsuffixes(SAVE(tcp));
- + #endif
- +
- set(STRshell, Strsave(STR_SHELLPATH));
-
- doldol = putn((int) getpid()); /* For $$ */
- ***************
- *** 708,713 ****
- --- 734,749 ----
- */
- if (nofile == 0 && argc > 0) {
- nofile = open(tempv[0], O_RDONLY);
- + #ifdef __MINT__
- + /* maybe the user tried to execute "foo.csh" as just "foo"
- + */
- + if (nofile < 0) {
- + char *cshfile = alloca(strlen(tempv[0]) + 5);
- + strcpy(cshfile, tempv[0]);
- + strcat(cshfile, ".csh");
- + nofile = open(cshfile, O_RDONLY);
- + }
- + #endif
- if (nofile < 0) {
- child = 1; /* So this ... */
- /* ... doesn't return */
- ***************
- *** 1920,1925 ****
- --- 1956,1965 ----
- #endif
- int i;
- {
- + #ifdef __MINT__
- + void rm_tmpfiles();
- + rm_tmpfiles(); /* remove temporary files, see below */
- + #endif
- #ifdef TESLA
- if (loginsh && do_logout) {
- /* this is to send hangup signal to the develcon */
- ***************
- *** 1986,1988 ****
- --- 2026,2165 ----
- *blkp = NULL;
- return (blk);
- }
- +
- + #ifdef __MINT__
- + /*
- + * unlink() doesn't always work on an open file, so we try to arrange
- + * to remove temporary files (e.g. for here documents) before exiting.
- + */
- +
- + struct tmpfile_rec {
- + char *name; /* the name of the temp. file */
- + int pid; /* the associated pid */
- + struct tmpfile_rec *next;
- + } *root;
- +
- + extern int __mint;
- +
- + int
- + csh_tmpfile()
- + {
- + extern char *tmpnam();
- + struct tmpfile_rec *u;
- + int fd;
- + char *name;
- +
- + if ( !(name = tmpnam((char *)0)) )
- + return -1;
- +
- + fd = open(name, O_CREAT|O_EXCL|O_RDWR, 0600);
- + if (fd < 0) {
- + free(name);
- + return -1;
- + }
- +
- + /* in MiNT 0.9 and above, we can often unlink a file and continue to use
- + * it; some file systems may return EACCDN for unlinking an open file,
- + * in which case we use the old method of unlinking the file at exit
- + */
- + if (__mint >= 9) {
- + if (unlink(name) == 0)
- + return fd;
- + }
- +
- + /* if the unlink failed, save the name for future deleting */
- +
- + u = (struct tmpfile_rec *)malloc(sizeof(*u));
- + if (!u) {
- + /* would it be better to fail? I dunno, but at worst the user is left
- + * with a junk file in a temporary directory
- + */
- + return fd;
- + }
- +
- + u->name = name;
- + u->pid = getpid();
- + u->next = root;
- + root = u;
- + return fd;
- + }
- +
- + void
- + rm_tmpfiles()
- + {
- + int pid = getpid();
- + struct tmpfile_rec **old, *u;
- +
- + old = &root;
- + u = root;
- + while (u) {
- + if (u->pid == pid) {
- + (void) unlink(u->name);
- + *old = u->next;
- + } else {
- + old = &u->next;
- + }
- + u = u->next;
- + }
- + }
- +
- + /* MiNT suffix stuff
- + */
- +
- + void
- + importsuffixes(cp)
- + Char *cp;
- + {
- + register int i = 0;
- + register Char *dp;
- + register Char **pv;
- + int c;
- +
- + for (dp = cp; *dp; dp++)
- + if (*dp == ',')
- + i++;
- + /*
- + * i+2 where i is the number of ',' in the suffix list. There are i+1
- + * suffixes plus we need room for a zero terminator.
- + */
- + pv = (Char **) xcalloc((size_t) (i + 2), sizeof(Char *));
- + dp = cp;
- + i = 0;
- + if (*dp)
- + for (;;) {
- + if ((c = *dp) == ',' || c == 0) {
- + *dp = 0;
- + pv[i++] = Strsave(cp);
- + if (c) {
- + cp = dp + 1;
- + *dp = ',';
- + }
- + else
- + break;
- + }
- + dp++;
- + }
- + pv[i] = 0;
- + set1(STRsuffixes, pv, &shvhed);
- + }
- +
- + static Char **
- + defaultsuffixes()
- + {
- + Char **blk, **blkp;
- +
- + blkp = blk = (Char **) xmalloc((size_t) sizeof(Char *) * 9);
- +
- + *blkp++ = SAVE("ttp");
- + *blkp++ = SAVE("prg");
- + *blkp++ = SAVE("tos");
- + *blkp++ = SAVE("app");
- + *blkp++ = SAVE("gtp");
- + *blkp++ = SAVE("csh");
- + *blkp++ = SAVE("");
- + *blkp = NULL;
- +
- + return (blk);
- + }
- +
- + #endif /* __MINT__ */
- diff --context --new-file --recursive ../tcsh-6.02/sh.char.c ./sh.char.c
- *** ../tcsh-6.02/sh.char.c Wed May 20 04:00:38 1992
- --- ./sh.char.c Sun Feb 21 01:38:56 1993
- ***************
- *** 51,57 ****
- --- 51,62 ----
- _CTR, _CTR|_SP|_META, _CTR|_NL|_META, _CTR,
-
- /* 12 np 13 cr 14 so 15 si */
- + #ifndef DOSTEXT
- _CTR, _CTR, _CTR, _CTR,
- + #else
- + /* cr is whitespace */
- + _CTR, _CTR|_SP|_META, _CTR, _CTR,
- + #endif
-
- /* 16 dle 17 dc1 18 dc2 19 dc3 */
- _CTR, _CTR, _CTR, _CTR,
- diff --context --new-file --recursive ../tcsh-6.02/sh.dir.c ./sh.dir.c
- *** ../tcsh-6.02/sh.dir.c Wed May 20 04:00:38 1992
- --- ./sh.dir.c Sun Feb 21 01:38:52 1993
- ***************
- *** 228,234 ****
- len = Strlen(hp);
- if (!(dirflag & DIR_LONG) && hp != NULL && !eq(hp, STRslash) &&
- Strncmp(hp, dp->di_name, len) == 0 &&
- ! (dp->di_name[len] == '\0' || dp->di_name[len] == '/'))
- len = Strlen(s = (dp->di_name + len)) + 2;
- else
- len = Strlen(s = dp->di_name) + 1;
- --- 228,234 ----
- len = Strlen(hp);
- if (!(dirflag & DIR_LONG) && hp != NULL && !eq(hp, STRslash) &&
- Strncmp(hp, dp->di_name, len) == 0 &&
- ! (dp->di_name[len] == '\0' || is_dirsep(dp->di_name[len])))
- len = Strlen(s = (dp->di_name + len)) + 2;
- else
- len = Strlen(s = dp->di_name) + 1;
- ***************
- *** 295,301 ****
- {
-
- /* return true if dp is of the form "../xxx" or "/../xxx" */
- ! #define HASDOTDOT(sp, p) (ISDOTDOT(p) && ((p) == (sp) || *((p) - 1) == '/'))
-
- #ifdef S_IFLNK
- if (exp) {
- --- 295,301 ----
- {
-
- /* return true if dp is of the form "../xxx" or "/../xxx" */
- ! #define HASDOTDOT(sp, p) (ISDOTDOT(p) && ((p) == (sp) || is_dirsep(*((p) - 1))))
-
- #ifdef S_IFLNK
- if (exp) {
- ***************
- *** 325,331 ****
- * If the path starts with a slash, we are not relative to
- * the current working directory.
- */
- ! if ( *start == '/' )
- *cwd = '\0';
- # ifdef apollo
- slashslash = cwd[0] == '/' && cwd[1] == '/';
- --- 325,331 ----
- * If the path starts with a slash, we are not relative to
- * the current working directory.
- */
- ! if ( is_abspath(start) )
- *cwd = '\0';
- # ifdef apollo
- slashslash = cwd[0] == '/' && cwd[1] == '/';
- ***************
- *** 356,362 ****
-
- *dp = '\0';
- while (dotdot > 0)
- ! if ((dp = Strrchr(cwd, '/')) != NULL) {
- # ifdef apollo
- if (dp == &cwd[1])
- slashslash = 1;
- --- 356,362 ----
-
- *dp = '\0';
- while (dotdot > 0)
- ! if ((dp = Lastslash(cwd)) != NULL) {
- # ifdef apollo
- if (dp == &cwd[1])
- slashslash = 1;
- ***************
- *** 384,396 ****
- # endif /* apollo */
-
- if (buf[0]) {
- ! if ((TRM(cwd[(dotdot = Strlen(cwd)) - 1])) != '/')
- cwd[dotdot++] = '/';
- cwd[dotdot] = '\0';
- ! dp = Strspl(cwd, TRM(buf[0]) == '/' ? &buf[1] : buf);
- xfree((ptr_t) cwd);
- cwd = dp;
- ! if ((TRM(cwd[(dotdot = Strlen(cwd)) - 1])) == '/')
- cwd[--dotdot] = '\0';
- }
- if (!*cp)
- --- 384,396 ----
- # endif /* apollo */
-
- if (buf[0]) {
- ! if (! is_dirsep(TRM(cwd[(dotdot = Strlen(cwd)) - 1])))
- cwd[dotdot++] = '/';
- cwd[dotdot] = '\0';
- ! dp = Strspl(cwd, is_dirsep(buf[0]) ? &buf[1] : buf);
- xfree((ptr_t) cwd);
- cwd = dp;
- ! if (is_dirsep(TRM(cwd[(dotdot = Strlen(cwd)) - 1])))
- cwd[--dotdot] = '\0';
- }
- if (!*cp)
- ***************
- *** 463,469 ****
- {
- Char *dp;
-
- ! if (*cp != '/') {
- register Char *p, *q;
- int cwdlen;
-
- --- 463,469 ----
- {
- Char *dp;
-
- ! if (! is_abspath(cp)) {
- register Char *p, *q;
- int cwdlen;
-
- ***************
- *** 537,543 ****
- serrno = errno;
- }
-
- ! if (cp[0] != '/' && !prefix(STRdotsl, cp) && !prefix(STRdotdotsl, cp)
- && (c = adrof(STRcdpath))) {
- Char **cdp;
- register Char *p;
- --- 537,543 ----
- serrno = errno;
- }
-
- ! if ((! is_abspath(cp)) && !prefix(STRdotsl, cp) && !prefix(STRdotdotsl, cp)
- && (c = adrof(STRcdpath))) {
- Char **cdp;
- register Char *p;
- ***************
- *** 568,574 ****
- }
- }
- dp = value(cp);
- ! if ((dp[0] == '/' || dp[0] == '.') && chdir(short2str(dp)) >= 0) {
- xfree((ptr_t) cp);
- cp = Strsave(dp);
- printd = 1;
- --- 568,574 ----
- }
- }
- dp = value(cp);
- ! if ((is_abspath(dp) || dp[0] == '.') && chdir(short2str(dp)) >= 0) {
- xfree((ptr_t) cp);
- cp = Strsave(dp);
- printd = 1;
- ***************
- *** 796,806 ****
- * christos: if the path given does not start with a slash prepend cwd. If
- * cwd does not start with a slash or the result would be too long abort().
- */
- ! if (*cp != '/') {
- Char tmpdir[MAXPATHLEN];
-
- p1 = value(STRcwd);
- ! if (p1 == NULL || *p1 != '/')
- abort();
- if (Strlen(p1) + Strlen(cp) + 1 >= MAXPATHLEN)
- abort();
- --- 796,806 ----
- * christos: if the path given does not start with a slash prepend cwd. If
- * cwd does not start with a slash or the result would be too long abort().
- */
- ! if (! is_abspath(cp)) {
- Char tmpdir[MAXPATHLEN];
-
- p1 = value(STRcwd);
- ! if (p1 == NULL || (! is_abspath(p1)))
- abort();
- if (Strlen(p1) + Strlen(cp) + 1 >= MAXPATHLEN)
- abort();
- ***************
- *** 812,818 ****
- }
-
- #ifdef COMMENT
- ! if (*cp != '/')
- abort();
- #endif /* COMMENT */
-
- --- 812,818 ----
- }
-
- #ifdef COMMENT
- ! if (! is_abspath(cp))
- abort();
- #endif /* COMMENT */
-
- ***************
- *** 822,828 ****
-
- while (*p) { /* for each component */
- sp = p; /* save slash address */
- ! while (*++p == '/') /* flush extra slashes */
- continue;
- if (p != ++sp)
- for (p1 = sp, p2 = p; (*p1++ = *p2++) != '\0';)
- --- 822,828 ----
-
- while (*p) { /* for each component */
- sp = p; /* save slash address */
- ! while (is_dirsep(*++p)) /* flush extra slashes */
- continue;
- if (p != ++sp)
- for (p1 = sp, p2 = p; (*p1++ = *p2++) != '\0';)
- ***************
- *** 830,836 ****
- p = sp; /* save start of component */
- slash = 0;
- while (*++p) /* find next slash or end of path */
- ! if (*p == '/') {
- slash = 1;
- *p = 0;
- break;
- --- 830,836 ----
- p = sp; /* save start of component */
- slash = 0;
- while (*++p) /* find next slash or end of path */
- ! if (is_dirsep(*p)) {
- slash = 1;
- *p = 0;
- break;
- ***************
- *** 880,891 ****
- */
- for (p1 = p; *p1++;)
- continue;
- ! if (*link != '/') {
- /*
- * Relative path, expand it between the "yyy/" and the
- * "/..". First, back sp up to the character past "yyy/".
- */
- ! while (*--sp != '/')
- continue;
- sp++;
- *sp = 0;
- --- 880,891 ----
- */
- for (p1 = p; *p1++;)
- continue;
- ! if (! is_abspath(link)) {
- /*
- * Relative path, expand it between the "yyy/" and the
- * "/..". First, back sp up to the character past "yyy/".
- */
- ! while (! is_dirsep(*--sp))
- continue;
- sp++;
- *sp = 0;
- ***************
- *** 934,940 ****
- #endif /* S_IFLNK */
- *sp = '/';
- if (sp != cp)
- ! while (*--sp != '/')
- continue;
- if (slash) {
- for (p1 = sp + 1, p2 = p + 1; (*p1++ = *p2++) != '\0';)
- --- 934,940 ----
- #endif /* S_IFLNK */
- *sp = '/';
- if (sp != cp)
- ! while (! is_dirsep(*--sp))
- continue;
- if (slash) {
- for (p1 = sp + 1, p2 = p + 1; (*p1++ = *p2++) != '\0';)
- ***************
- *** 971,983 ****
- */
- for (p1 = p; *p1++;)
- continue;
- ! if (*link != '/') {
- /*
- * Relative path, expand it between the "yyy/" and the
- * remainder. First, back sp up to the character past
- * "yyy/".
- */
- ! while (*--sp != '/')
- continue;
- sp++;
- *sp = 0;
- --- 971,983 ----
- */
- for (p1 = p; *p1++;)
- continue;
- ! if (! is_abspath(link)) {
- /*
- * Relative path, expand it between the "yyy/" and the
- * remainder. First, back sp up to the character past
- * "yyy/".
- */
- ! while (! is_dirsep(*--sp))
- continue;
- sp++;
- *sp = 0;
- ***************
- *** 1038,1045 ****
- /*
- * See if we're not in a subdir of STRhome
- */
- ! if (p1 && *p1 == '/' &&
- ! (Strncmp(p1, cp, cc) != 0 || (cp[cc] != '/' && cp[cc] != '\0'))) {
- static ino_t home_ino = (ino_t) -1;
- static dev_t home_dev = -1;
- static Char *home_ptr = NULL;
- --- 1038,1045 ----
- /*
- * See if we're not in a subdir of STRhome
- */
- ! if (p1 && is_abspath(p1) &&
- ! (Strncmp(p1, cp, cc) != 0 || ((! is_dirsep(cp[cc])) && cp[cc] != '\0'))) {
- static ino_t home_ino = (ino_t) -1;
- static dev_t home_dev = -1;
- static Char *home_ptr = NULL;
- ***************
- *** 1064,1070 ****
- sp = (Char *) - 1;
- break;
- }
- ! if ((sp = Strrchr(p2, '/')) != NULL)
- *sp = '\0';
- }
- /*
- --- 1064,1070 ----
- sp = (Char *) - 1;
- break;
- }
- ! if ((sp = Lastslash(p2)) != NULL)
- *sp = '\0';
- }
- /*
- diff --context --new-file --recursive ../tcsh-6.02/sh.dol.c ./sh.dol.c
- *** ../tcsh-6.02/sh.dol.c Wed May 20 04:00:38 1992
- --- ./sh.dol.c Sun Feb 21 01:38:52 1993
- ***************
- *** 444,449 ****
- --- 444,455 ----
- if (dimen)
- stderror(ERR_NOTALLOWED, "$?#");
- for (np = wbuf; read(OLDSTD, &tnp, 1) == 1; np++) {
- + #ifdef DOSTEXT
- + /* strip out cr's */
- + while (tnp == '\r') {
- + if (read(OLDSTD, &tnp, 1) != 1) break;
- + }
- + #endif
- *np = (unsigned char) tnp;
- if (np >= &wbuf[BUFSIZE - 1])
- stderror(ERR_LTOOLONG);
- ***************
- *** 873,878 ****
- --- 879,895 ----
- register Char *lbp, *obp, *mbp;
- Char **vp;
- bool quoted;
- +
- + #ifdef __MINT__
- + int tf;
- + extern int csh_tmpfile __P((void)); /* in sh.c */
- +
- + tf = csh_tmpfile();
- + if (tf < 0)
- + stderror(ERR_SYSTEM, "tmpfile", strerror(errno));
- + (void)dup2(tf, 0);
- + (void)close(tf);
- + #else
- char *tmp;
-
- if (creat(tmp = short2str(shtemp), 0600) < 0)
- ***************
- *** 886,891 ****
- --- 903,910 ----
- stderror(ERR_SYSTEM, tmp, strerror(errno));
- }
- (void) unlink(tmp); /* 0 0 inode! */
- + #endif
- +
- Dv[0] = term;
- Dv[1] = NULL;
- gflag = 0;
- diff --context --new-file --recursive ../tcsh-6.02/sh.exec.c ./sh.exec.c
- *** ../tcsh-6.02/sh.exec.c Wed May 20 04:00:38 1992
- --- ./sh.exec.c Sun Feb 21 01:38:54 1993
- ***************
- *** 49,54 ****
- --- 49,60 ----
- # define FASTHASH /* Fast hashing is the default */
- #endif /* OLDHASH */
-
- + #ifdef __MINT__
- + extern char **environ;
- + int csh_execve __P((char *, char **, char **));
- + #define execv(f, t) csh_execve(f, t, environ)
- + #endif
- +
- /*
- * System level search and execute of a command.
- * We look in each directory for the specified command name.
- ***************
- *** 180,190 ****
- #endif
-
- v = adrof(STRpath);
- ! if (v == 0 && expath[0] != '/') {
- blkfree(pv);
- pexerr();
- }
- ! slash = any(short2str(expath), '/');
-
- /*
- * Glob the argument list, if necessary. Otherwise trim off the quote bits.
- --- 186,196 ----
- #endif
-
- v = adrof(STRpath);
- ! if (v == 0 && (! is_abspath(expath))) {
- blkfree(pv);
- pexerr();
- }
- ! slash = hasslash(short2str(expath));
-
- /*
- * Glob the argument list, if necessary. Otherwise trim off the quote bits.
- ***************
- *** 266,272 ****
- * one at a time, as the user enters them. This is kinda like Korn
- * Shell's "tracked aliases".
- */
- ! if (!slash && pv[0][0] == '/' && havhash) {
- #ifdef FASTHASH
- if (!bit(hashval, i))
- goto cont;
- --- 272,278 ----
- * one at a time, as the user enters them. This is kinda like Korn
- * Shell's "tracked aliases".
- */
- ! if (!slash && is_abspath(pv[0]) && havhash) {
- #ifdef FASTHASH
- if (!bit(hashval, i))
- goto cont;
- ***************
- *** 377,383 ****
- --- 383,393 ----
- */
- if ((fd = open(f, O_RDONLY)) != -1) {
- if (read(fd, (char *) &c, 1) == 1) {
- + #ifndef DOSTEXT
- if (!Isprint(c) && (c != '\n' && c != '\t')) {
- + #else
- + if (!Isprint(c) && (c != '\n' && c != '\r' && c != '\t')) {
- + #endif
- (void) close(fd);
- /*
- * We *know* what ENOEXEC means.
- ***************
- *** 404,410 ****
- --- 414,422 ----
- #ifdef _PATH_BSHELL
- if (fd != -1
- # ifndef ISC /* Compatible with ISC's /bin/csh */
- + # ifndef __MINT__ /* Compensate for missing #! interpretation */
- && c != '#'
- + # endif /* __MINT__ */
- # endif /* ISC */
- )
- vp[0] = STR_BSHELL;
- ***************
- *** 580,585 ****
- --- 592,601 ----
- struct varent *v = adrof(STRpath);
- Char **pv;
- int hashval;
- + #ifdef __MINT__
- + struct varent *suffv = adrof(STRsuffixes);
- + Char **suffpv;
- + #endif
-
- #ifdef FASTHASH
- if (vv && vv[1]) {
- ***************
- *** 620,626 ****
- if (v == NULL)
- return;
- for (pv = v->vec; *pv; pv++, i++) {
- ! if (pv[0][0] != '/')
- continue;
- dirp = opendir(short2str(*pv));
- if (dirp == NULL)
- --- 636,642 ----
- if (v == NULL)
- return;
- for (pv = v->vec; *pv; pv++, i++) {
- ! if (! is_abspath(pv[0]))
- continue;
- dirp = opendir(short2str(*pv));
- if (dirp == NULL)
- ***************
- *** 639,644 ****
- --- 655,673 ----
- (dp->d_name[1] == '\0' ||
- (dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
- continue;
- + #ifdef __MINT__
- + { char *s = rindex(dp->d_name, '.');
- +
- + if (s && suffv) {
- + for (suffpv = suffv->vec; *suffpv; suffpv++) {
- + if (!strcmp(s+1, short2str(*suffpv))) {
- + *s = 0; break;
- + }
- + }
- + }
- + }
- + #endif /* __MINT__ */
- +
- #ifdef FASTHASH
- hashval = hashname(str2short(dp->d_name));
- bis(hashval, i);
- ***************
- *** 712,718 ****
- register Char **pv;
- register Char *sav;
- register struct varent *v;
- ! register bool slash = any(short2str(name), '/');
- register int hashval, i;
-
- v = adrof(STRpath);
- --- 741,747 ----
- register Char **pv;
- register Char *sav;
- register struct varent *v;
- ! register bool slash = hasslash(short2str(name));
- register int hashval, i;
-
- v = adrof(STRpath);
- ***************
- *** 724,730 ****
- hashval = havhash ? hashname(name) : 0;
- i = 0;
- do {
- ! if (!slash && pv[0][0] == '/' && havhash) {
- #ifdef FASTHASH
- if (!bit(hashval, i))
- goto cont;
- --- 753,759 ----
- hashval = havhash ? hashname(name) : 0;
- i = 0;
- do {
- ! if (!slash && is_abspath(pv[0]) && havhash) {
- #ifdef FASTHASH
- if (!bit(hashval, i))
- goto cont;
- ***************
- *** 770,775 ****
- --- 799,857 ----
- * if dir_ok is set and the pathname refers to a directory.
- * This is a bit kludgy, but in the name of optimization...
- */
- + #ifdef __MINT__
- + int
- + executable(dir, name, dir_ok)
- + Char *dir, *name;
- + bool dir_ok;
- + {
- + char *ext, *base;
- + int i;
- + struct stat stbuf;
- + Char path[MAXPATHLEN + 1];
- + char *strname;
- + struct varent *v;
- + Char **pv;
- +
- + if (dir && *dir) {
- + copyn(path, dir, MAXPATHLEN);
- + catn(path, name, MAXPATHLEN);
- + strname = short2str(path);
- + }
- + else
- + strname = short2str(name);
- +
- + ext = base = alloca(strlen(strname) + 5);
- + while (*strname)
- + *ext++ = *strname++;
- +
- + *ext = 0;
- +
- + if (stat(base, &stbuf) != -1 &&
- + ((dir_ok && S_ISDIR(stbuf.st_mode)) ||
- + (S_ISREG(stbuf.st_mode) &&
- + ((stbuf.st_mode & (S_IXOTH|S_IXGRP|S_IXUSR))))))
- + return 1;
- +
- + if (dir_ok) return 0;
- +
- + v = adrof(STRsuffixes);
- + if (v == 0) return 0;
- +
- + *ext++ = '.';
- + for (pv = v->vec; *pv; pv++) {
- + strcpy(ext, short2str(*pv));
- + if (stat(base, &stbuf) != -1 &&
- + (S_ISREG(stbuf.st_mode) &&
- + ((stbuf.st_mode & (S_IXOTH|S_IXGRP|S_IXUSR)) ||
- + !strcmp(ext, "csh"))))
- + return 1;
- + }
- + return 0;
- + }
- +
- + #else /* __MINT__ */
- +
- int
- executable(dir, name, dir_ok)
- Char *dir, *name;
- ***************
- *** 795,800 ****
- --- 877,884 ----
- access(strname, X_OK) == 0)));
- }
-
- + #endif /* __MINT__ */
- +
- void
- tellmewhat(lex)
- struct wordent *lex;
- ***************
- *** 853,859 ****
- if ((i = iscommand(strip(sp->word))) != 0) {
- register Char **pv;
- register struct varent *v;
- ! bool slash = any(short2str(sp->word), '/');
-
- v = adrof(STRpath);
- if (v == 0 || v->vec[0] == 0 || slash)
- --- 937,943 ----
- if ((i = iscommand(strip(sp->word))) != 0) {
- register Char **pv;
- register struct varent *v;
- ! bool slash = hasslash(short2str(sp->word));
-
- v = adrof(STRpath);
- if (v == 0 || v->vec[0] == 0 || slash)
- ***************
- *** 918,924 ****
- Char *sv;
- int hashval, i, ex, rval = 0;
-
- ! if (prt && any(short2str(cmd), '/')) {
- xprintf("where: / in command makes no sense\n");
- return 0;
- }
- --- 1002,1008 ----
- Char *sv;
- int hashval, i, ex, rval = 0;
-
- ! if (prt && hasslash(short2str(cmd))) {
- xprintf("where: / in command makes no sense\n");
- return 0;
- }
- ***************
- *** 985,987 ****
- --- 1069,1110 ----
- xfree((ptr_t) sv);
- return rval;
- }
- +
- + #ifdef __MINT__
- +
- + #include <process.h>
- +
- + int
- + csh_execve(path, argv, envp)
- + char *path;
- + char **argv, **envp;
- + {
- + int i;
- + char *newpath, *s;
- + Char **pv;
- + struct varent *v;
- +
- + newpath = s = alloca(strlen(path) + 5);
- + while (*path) {
- + *s++ = *path++;
- + }
- + *s = 0;
- +
- + if (access(newpath, 0) == 0)
- + return _spawnve(P_OVERLAY, newpath, argv, envp);
- +
- + v = adrof(STRsuffixes);
- + if (v == 0)
- + return -1;
- + *s++ = '.';
- +
- + for (pv = v->vec; *pv; pv++) {
- + strcpy(s, short2str(*pv));
- + if (access(newpath, 0) == 0) {
- + return _spawnve(P_OVERLAY, newpath, argv, envp);
- + }
- + }
- + return -1;
- + }
- + #endif /* __MINT__ */
- +
- diff --context --new-file --recursive ../tcsh-6.02/sh.file.c ./sh.file.c
- *** ../tcsh-6.02/sh.file.c Wed May 20 04:00:38 1992
- --- ./sh.file.c Sun Feb 21 01:38:56 1993
- ***************
- *** 407,413 ****
- if (old[0] != '~')
- return (Strcpy(new, old));
-
- ! for (p = person, o = &old[1]; *o && *o != '/'; *p++ = *o++);
- *p = '\0';
- if (person[0] == '\0')
- (void) Strcpy(new, value(STRhome));
- --- 407,413 ----
- if (old[0] != '~')
- return (Strcpy(new, old));
-
- ! for (p = person, o = &old[1]; *o && (! is_dirsep(*o)); *p++ = *o++);
- *p = '\0';
- if (person[0] == '\0')
- (void) Strcpy(new, value(STRhome));
- ***************
- *** 502,508 ****
- {
- register Char *p;
-
- ! p = Strrchr(path, '/');
- if (p == NULL) {
- copyn(name, path, MAXNAMLEN);
- dir[0] = '\0';
- --- 502,508 ----
- {
- register Char *p;
-
- ! p = Lastslash(path);
- if (p == NULL) {
- copyn(name, path, MAXNAMLEN);
- dir[0] = '\0';
- ***************
- *** 582,588 ****
- if (items != NULL)
- FREE_ITEMS(items);
-
- ! looking_for_lognames = (*word == '~') && (Strchr(word, '/') == NULL);
- if (looking_for_lognames) {
- (void) setpwent();
- copyn(name, &word[1], MAXNAMLEN); /* name sans ~ */
- --- 582,588 ----
- if (items != NULL)
- FREE_ITEMS(items);
-
- ! looking_for_lognames = (*word == '~') && (! Hasslash(word));
- if (looking_for_lognames) {
- (void) setpwent();
- copyn(name, &word[1], MAXNAMLEN); /* name sans ~ */
- diff --context --new-file --recursive ../tcsh-6.02/sh.func.c ./sh.func.c
- *** ../tcsh-6.02/sh.func.c Wed May 20 04:00:38 1992
- --- ./sh.func.c Sun Feb 21 01:38:58 1993
- ***************
- *** 66,71 ****
- --- 66,75 ----
- static void toend __P((void));
- static void xecho __P((int, Char **));
-
- + #ifdef __MINT__
- + extern void importsuffixes __P((Char *)); /* in sh.c */
- + #endif
- +
- struct biltins *
- isbfunc(t)
- struct command *t;
- ***************
- *** 272,278 ****
- --- 276,293 ----
- islogin();
- rechist();
- (void) signal(SIGTERM, parterm);
- + #ifdef __MINT__
- + {
- + extern int csh_execve __P((char *, char **, char **)); /* in sh.exec.c */
- + extern char **environ;
- + char *args[3];
- +
- + args[0] = "login"; args[1] = short2str(v[1]); args[2] = NULL;
- + (void)csh_execve(_PATH_LOGIN, args, environ);
- + }
- + #else
- (void) execl(_PATH_LOGIN, "login", short2str(v[1]), NULL);
- + #endif
- untty();
- xexit(1);
- }
- ***************
- *** 1162,1167 ****
- --- 1177,1188 ----
- importpath(lp);
- dohash(NULL, NULL);
- }
- + #ifdef __MINT__
- + else if (eq(vp, STRSUFFIXES)) {
- + importsuffixes(lp);
- + dohash(NULL, NULL);
- + }
- + #endif /* __MINT__ */
- #ifdef apollo
- else if (eq(vp, STRSYSTYPE))
- dohash(NULL, NULL);
- ***************
- *** 1256,1261 ****
- --- 1277,1286 ----
- maxi = 1;
- if (eq(name, STRNOREBIND))
- NoNLSRebind = 0;
- + #ifdef __MINT__
- + else if (eq(name, STRSUFFIXES))
- + dohash(NULL, NULL);
- + #endif
- #ifdef apollo
- else if (eq(name, STRSYSTYPE))
- dohash(NULL, NULL);
- diff --context --new-file --recursive ../tcsh-6.02/sh.glob.c ./sh.glob.c
- *** ../tcsh-6.02/sh.glob.c Wed May 20 04:00:40 1992
- --- ./sh.glob.c Sun Feb 21 01:38:58 1993
- ***************
- *** 97,103 ****
- *gstart++ = *s++;
- u = s;
- for (b = gstart, e = &gbuf[MAXPATHLEN - 1];
- ! *s && *s != '/' && *s != ':' && b < e;
- *b++ = *s++)
- continue;
- *b = EOS;
- --- 97,103 ----
- *gstart++ = *s++;
- u = s;
- for (b = gstart, e = &gbuf[MAXPATHLEN - 1];
- ! *s && (! is_dirsep(*s)) && *s != ':' && b < e;
- *b++ = *s++)
- continue;
- *b = EOS;
- ***************
- *** 135,141 ****
- * kfk - 17 Jan 1984 - stack hack allows user to get at arbitrary dir names
- * in stack. PWP: let =foobar pass through (for X windows)
- */
- ! if (old[1] == '-' && (old[2] == '\0' || old[2] == '/')) {
- /* =- */
- dig = -1;
- b = &old[2];
- --- 135,141 ----
- * kfk - 17 Jan 1984 - stack hack allows user to get at arbitrary dir names
- * in stack. PWP: let =foobar pass through (for X windows)
- */
- ! if (old[1] == '-' && (old[2] == '\0' || is_dirsep(old[2]))) {
- /* =- */
- dig = -1;
- b = &old[2];
- ***************
- *** 145,151 ****
- dig = old[1] - '0';
- for (b = &old[2]; Isdigit(*b); b++)
- dig = dig * 10 + (*b - '0');
- ! if (*b != '\0' && *b != '/')
- /* =<number>foobar */
- return old;
- }
- --- 145,151 ----
- dig = old[1] - '0';
- for (b = &old[2]; Isdigit(*b); b++)
- dig = dig * 10 + (*b - '0');
- ! if (*b != '\0' && (! is_dirsep(*b)))
- /* =<number>foobar */
- return old;
- }
- ***************
- *** 665,671 ****
- else if (isglob(*c))
- gflag |= G_GLOB;
- else if (symlinks == SYM_EXPAND &&
- ! *p && ISDOTDOT(c) && (c == *(t-1) || *(c-1) == '/') )
- gflag |= G_CSH;
- }
- }
- --- 665,671 ----
- else if (isglob(*c))
- gflag |= G_GLOB;
- else if (symlinks == SYM_EXPAND &&
- ! *p && ISDOTDOT(c) && (c == *(t-1) || is_dirsep(*(c-1))))
- gflag |= G_CSH;
- }
- }
- ***************
- *** 836,841 ****
- --- 836,857 ----
- do
- icnt = read(pvec[0], tibuf, BUFSIZE);
- while (icnt == -1 && errno == EINTR);
- + #ifdef DOSTEXT
- + /* strip out carriage returns */
- + {
- + char *src, *dst;
- + int i;
- + src = dst = tibuf;
- +
- + for (i = icnt; i > 0; --i) {
- + if (*src == '\r')
- + --icnt;
- + else
- + *dst++ = *src;
- + src++;
- + }
- + }
- + #endif
- if (icnt <= 0) {
- c = -1;
- break;
- diff --context --new-file --recursive ../tcsh-6.02/sh.h ./sh.h
- *** ../tcsh-6.02/sh.h Wed May 20 04:00:42 1992
- --- ./sh.h Sun Feb 21 01:39:08 1993
- ***************
- *** 160,166 ****
- #ifdef _SEQUENT_
- # include <sys/procstats.h>
- #endif /* _SEQUENT_ */
- ! #if defined(POSIX) || SYSVREL > 0
- # include <sys/times.h>
- #endif /* POSIX || SYSVREL > 0 */
-
- --- 160,166 ----
- #ifdef _SEQUENT_
- # include <sys/procstats.h>
- #endif /* _SEQUENT_ */
- ! #if defined(POSIX) || SYSVREL > 0 || defined(__MINT__)
- # include <sys/times.h>
- #endif /* POSIX || SYSVREL > 0 */
-
- ***************
- *** 173,178 ****
- --- 173,182 ----
- #endif /* _MINIX */
- #include <sys/stat.h>
-
- + #ifdef __MINT__
- + #include <support.h>
- + #endif
- +
- #ifdef BSDTIMES
- # include <sys/time.h>
- # if SYSVREL>3
- ***************
- *** 202,208 ****
- # define CSWTCH _POSIX_VDISABLE /* So job control works */
- #endif /* DGUX */
-
- ! #ifdef POSIX
- /*
- * We should be using setpgid and setpgid
- * by now, but in some systems we use the
- --- 206,212 ----
- # define CSWTCH _POSIX_VDISABLE /* So job control works */
- #endif /* DGUX */
-
- ! #if defined(POSIX) || defined(__MINT__)
- /*
- * We should be using setpgid and setpgid
- * by now, but in some systems we use the
- ***************
- *** 261,266 ****
- --- 265,277 ----
-
- #include <errno.h>
-
- + #ifdef __MINT__
- + /* undef E_SEEK from errno.h */
- + # undef E_SEEK
- + # define ENOTDIR EPATH
- + # define ESPIPE EINVAL
- + #endif
- +
- #include <setjmp.h>
-
- #if __STDC__
- ***************
- *** 318,323 ****
- --- 329,349 ----
- # endif
- #endif
-
- + #ifndef DOSFS
- + # define is_dirsep(c) ((c) == '/')
- + # define is_abspath(p) (is_dirsep(*(p)))
- + # define lastslash(p) (strrchr((p), '/'))
- + # define Lastslash(p) (Strrchr((p), '/'))
- + # define hasslash(p) (any((p), '/'))
- + # define Hasslash(p) (Strrchr((p), '/'))
- + #else
- + extern int is_dirsep __P((int));
- + extern int is_abspath __P((Char *));
- + extern char * lastslash __P((char *));
- + extern Char * Lastslash __P((Char *));
- + extern int hasslash __P((char *));
- + extern int Hasslash __P((Char *));
- + #endif
-
- typedef int bool;
-
- diff --context --new-file --recursive ../tcsh-6.02/sh.lex.c ./sh.lex.c
- *** ../tcsh-6.02/sh.lex.c Wed May 20 04:00:40 1992
- --- ./sh.lex.c Sun Feb 21 01:39:02 1993
- ***************
- *** 387,393 ****
- for (;;) {
- if ((c = peekc) != 0) {
- peekc = 0;
- ! return (c);
- }
- if (lap) {
- if ((c = *lap++) == 0)
- --- 387,393 ----
- for (;;) {
- if ((c = peekc) != 0) {
- peekc = 0;
- ! goto ret_c;
- }
- if (lap) {
- if ((c = *lap++) == 0)
- ***************
- *** 395,410 ****
- else {
- if (cmap(c, _META | _Q | _Q1))
- c |= QUOTE;
- ! return (c);
- }
- }
- if ((c = peekd) != 0) {
- peekd = 0;
- ! return (c);
- }
- if (exclp) {
- if ((c = *exclp++) != 0)
- ! return (c);
- if (exclnxt && --exclc >= 0) {
- exclnxt = exclnxt->next;
- setexclp(exclnxt->word);
- --- 395,410 ----
- else {
- if (cmap(c, _META | _Q | _Q1))
- c |= QUOTE;
- ! goto ret_c;
- }
- }
- if ((c = peekd) != 0) {
- peekd = 0;
- ! goto ret_c;
- }
- if (exclp) {
- if ((c = *exclp++) != 0)
- ! goto ret_c;
- if (exclnxt && --exclc >= 0) {
- exclnxt = exclnxt->next;
- setexclp(exclnxt->word);
- ***************
- *** 433,438 ****
- --- 433,445 ----
- break;
- }
- return (c);
- +
- + ret_c:
- + #ifdef DOSTEXT
- + return (c == '\r' ? getC1(flag) : c);
- + #else
- + return (c);
- + #endif
- }
-
- static void
- ***************
- *** 1060,1069 ****
-
- case 'h':
- case 't':
- ! if (!any(short2str(cp), '/'))
- return (type == 't' ? Strsave(cp) : 0);
- wp = Strend(cp);
- ! while (*--wp != '/')
- continue;
- if (type == 'h')
- xp = Strsave(cp), xp[wp - cp] = 0;
- --- 1067,1076 ----
-
- case 'h':
- case 't':
- ! if (! hasslash(short2str(cp)))
- return (type == 't' ? Strsave(cp) : 0);
- wp = Strend(cp);
- ! while (! is_dirsep(*--wp))
- continue;
- if (type == 'h')
- xp = Strsave(cp), xp[wp - cp] = 0;
- ***************
- *** 1074,1080 ****
- case 'e':
- case 'r':
- wp = Strend(cp);
- ! for (wp--; wp >= cp && *wp != '/'; wp--)
- if (*wp == '.') {
- if (type == 'e')
- xp = Strsave(wp + 1);
- --- 1081,1087 ----
- case 'e':
- case 'r':
- wp = Strend(cp);
- ! for (wp--; wp >= cp && (! is_dirsep(*wp)); wp--)
- if (*wp == '.') {
- if (type == 'e')
- xp = Strsave(wp + 1);
- ***************
- *** 1554,1560 ****
- }
- c = fbuf[0][fseekp - fbobp];
- fseekp++;
- ! return (c);
- }
- again:
- buf = (int) fseekp / BUFSIZE;
- --- 1561,1567 ----
- }
- c = fbuf[0][fseekp - fbobp];
- fseekp++;
- ! goto ret_c;
- }
- again:
- buf = (int) fseekp / BUFSIZE;
- ***************
- *** 1646,1652 ****
- --- 1653,1665 ----
- }
- c = fbuf[buf][(int) fseekp % BUFSIZE];
- fseekp++;
- +
- + ret_c:
- + #ifdef DOSTEXT
- + return (c == '\r' ? bgetc() : c);
- + #else
- return (c);
- + #endif
- }
-
- static void
- diff --context --new-file --recursive ../tcsh-6.02/sh.misc.c ./sh.misc.c
- *** ../tcsh-6.02/sh.misc.c Wed May 20 04:00:40 1992
- --- ./sh.misc.c Sun Feb 21 01:39:02 1993
- ***************
- *** 38,43 ****
- --- 38,47 ----
-
- RCSID("$Id: sh.misc.c,v 3.12 1992/03/27 01:59:46 christos Exp $")
-
- + #ifdef __MINT__
- + extern int __mint; /* kernel version */
- + #endif
- +
- static int renum __P((int, int));
- static Char **blkend __P((Char **));
- static Char **blkcat __P((Char **, Char **));
- ***************
- *** 266,271 ****
- --- 270,281 ----
- {
- register int f;
-
- + #ifdef __MINT__
- + /* in TOS, all handles are shared by all processes! (ack!) */
- + if (__mint == 0)
- + return;
- + #endif
- +
- if (didcch)
- return;
- didcch = 1;
- ***************
- *** 304,309 ****
- --- 314,322 ----
- if (i == j || i < 0)
- return (i);
- #ifdef HAVEDUP2
- + # ifdef __MINT__
- + if (__mint != 0) /* TOS screws up dup2 */
- + # endif
- if (j >= 0) {
- (void) dup2(i, j);
- if (j != i)
- ***************
- *** 324,329 ****
- --- 337,347 ----
-
- if (i == j || i < 0 || (j < 0 && i > 2))
- return (i);
- + #ifdef __MINT__
- + if (__mint == 0 && j > 5) {
- + return (i <= 5) ? dup(i) : j;
- + }
- + #endif
- #ifdef HAVEDUP2
- if (j >= 0) {
- (void) dup2(i, j);
- ***************
- *** 458,460 ****
- --- 476,561 ----
- return (0);
- }
- }
- +
- + #ifdef DOSFS
- +
- + int
- + is_dirsep(i)
- + int i;
- + {
- + return i == '/' || i == '\\' ;
- + }
- +
- + int
- + is_abspath(pth)
- + register Char *pth;
- + {
- + return is_dirsep(TRM(*pth)) || TRM(pth[1]) == ':';
- + }
- +
- + char *
- + lastslash(pth)
- + register char *pth;
- + {
- + register char *slash = 0, *s = pth, c;
- +
- + if (! s) return 0;
- +
- + while ( (c = *s++) != 0) {
- + if (is_dirsep(c))
- + slash = s - 1;
- + }
- + if (slash)
- + return slash;
- + return (pth[1] == ':') ? pth : 0;
- + }
- +
- + Char *
- + Lastslash(pth)
- + register Char *pth;
- + {
- + register Char *slash = 0, *s = pth, c;
- +
- + if (! s) return 0;
- +
- + while ( (c = *s++) != 0) {
- + if (is_dirsep(c))
- + slash = s - 1;
- + }
- + if (slash)
- + return slash;
- + return (pth[1] == ':') ? pth : 0;
- + }
- +
- + int
- + hasslash(pth)
- + register char *pth;
- + {
- + register char c;
- +
- + if (! pth) return 0;
- +
- + while ( (c = *pth++) != 0)
- + if (is_dirsep(c))
- + return 1;
- +
- + return 0;
- + }
- +
- + int
- + Hasslash(pth)
- + register Char *pth;
- + {
- + register Char c;
- +
- + if (! pth) return 0;
- +
- + while ( (c = *pth++) != 0)
- + if (is_dirsep(c))
- + return 1;
- +
- + return 0;
- + }
- +
- + #endif /* DOSFS */
- +
- diff --context --new-file --recursive ../tcsh-6.02/sh.proc.c ./sh.proc.c
- *** ../tcsh-6.02/sh.proc.c Wed May 20 04:00:40 1992
- --- ./sh.proc.c Sun Feb 21 01:39:04 1993
- ***************
- *** 83,94 ****
- 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L};
-
- # else /* !sun && !hp9000 */
- ! # ifdef masscomp
- /*
- * Initialization of this structure under RTU 4.1A & RTU 5.0 is problematic
- * because the first two elements are unions of a time_t and a struct timeval.
- * So we'll just have to trust the loader to do the "right thing", DAS DEC-90.
- */
- static struct rusage zru;
- # else /* masscomp */
- static struct rusage zru = {{0L, 0L}, {0L, 0L}, 0, 0, 0, 0, 0, 0, 0,
- --- 83,97 ----
- 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L};
-
- # else /* !sun && !hp9000 */
- ! # if defined(masscomp) || defined(__MINT__)
- /*
- * Initialization of this structure under RTU 4.1A & RTU 5.0 is problematic
- * because the first two elements are unions of a time_t and a struct timeval.
- * So we'll just have to trust the loader to do the "right thing", DAS DEC-90.
- */
- + /* MiNT is missing a lot of fields, so we also trust the loader (we can
- + * trust it) to avoid getting errors from the compiler
- + */
- static struct rusage zru;
- # else /* masscomp */
- static struct rusage zru = {{0L, 0L}, {0L, 0L}, 0, 0, 0, 0, 0, 0, 0,
- ***************
- *** 120,125 ****
- --- 123,146 ----
- static void okpcntl __P((void));
- static struct process *pfind __P((Char *));
-
- + #ifdef __MINT__
- + /*
- + * MiNT's fork() is a lot like vfork() in some respects; in particular,
- + * if we set job control signals to SIG_DFL after fork() and then
- + * get a signal, our parent will never be able to reclaim the address
- + * space and everything will hang :-(. Solution: rather than SIG_DFL,
- + * set the signals to a null signal handler; if we exec(), they will
- + * be set to SIG_DFL automatically, and before then the signals will
- + * effectively be ignored.
- + */
- +
- + void
- + sig_tmp_ign(int sig)
- + {
- + /* do nothing, and rely on the magic of restartable system calls :-) */
- + }
- + #endif
- +
- /*
- * pchild - called at interrupt level by the SIGCHLD signal
- * indicating that at least one child has terminated or stopped
- ***************
- *** 1826,1835 ****
- --- 1847,1863 ----
- (void) signal(SIGQUIT, ignint ? SIG_IGN : SIG_DFL);
- #ifdef BSDJOBS
- if (wanttty >= 0) {
- + # ifdef __MINT__
- + /* see comments for sig_tmp_ign above */
- + (void) signal(SIGTSTP, sig_tmp_ign);
- + (void) signal(SIGTTIN, sig_tmp_ign);
- + (void) signal(SIGTTOU, sig_tmp_ign);
- + # else
- /* make stoppable */
- (void) signal(SIGTSTP, SIG_DFL);
- (void) signal(SIGTTIN, SIG_DFL);
- (void) signal(SIGTTOU, SIG_DFL);
- + # endif
- }
- #endif /* BSDJOBS */
- (void) signal(SIGTERM, parterm);
- diff --context --new-file --recursive ../tcsh-6.02/sh.sem.c ./sh.sem.c
- *** ../tcsh-6.02/sh.sem.c Wed May 20 04:00:42 1992
- --- ./sh.sem.c Sun Feb 21 01:39:06 1993
- ***************
- *** 490,498 ****
- --- 490,507 ----
- }
- # ifdef BSDJOBS
- if (_gv.wanttty >= 0) {
- + # ifdef __MINT__
- + /* see sh.proc.c */
- + extern void sig_tmp_ign();
- +
- + (void) signal(SIGTSTP, sig_tmp_ign);
- + (void) signal(SIGTTIN, sig_tmp_ign);
- + (void) signal(SIGTTOU, sig_tmp_ign);
- + # else
- (void) signal(SIGTSTP, SIG_DFL);
- (void) signal(SIGTTIN, SIG_DFL);
- (void) signal(SIGTTOU, SIG_DFL);
- + # endif
- }
- # endif /* BSDJOBS */
-
- ***************
- *** 624,631 ****
- --- 633,642 ----
- execute(t->t_dcdr, _gv.wanttty, pv, pipeout);
- t->t_dcar->t_dflg |= F_PIPEOUT |
- (t->t_dflg & (F_PIPEIN | F_AMPERSAND | F_STDERR | F_NOINTERRUPT));
- + # ifndef __MINT__
- if (_gv.wanttty > 0)
- _gv.wanttty = 0; /* got tty already */
- + # endif
- execute(t->t_dcar, _gv.wanttty, pipein, pv);
- #else /* !BACKPIPE */
- t->t_dcar->t_dflg |= F_PIPEOUT |
- ***************
- *** 633,640 ****
- --- 644,653 ----
- execute(t->t_dcar, _gv.wanttty, pipein, pv);
- t->t_dcdr->t_dflg |= F_PIPEIN | (t->t_dflg &
- (F_PIPEOUT | F_AMPERSAND | F_NOFORK | F_NOINTERRUPT));
- + # ifndef __MINT__
- if (_gv.wanttty > 0)
- _gv.wanttty = 0; /* got tty already */
- + # endif
- execute(t->t_dcdr, _gv.wanttty, pv, pipeout);
- #endif /* BACKPIPE */
- break;
- ***************
- *** 803,820 ****
- --- 816,847 ----
- (void) dmove(fd, 0);
- }
- else if (flags & F_PIPEIN) {
- + #ifdef __MINT__
- + (void) dup2(pipein[0], 0);
- + #else
- (void) close(0);
- (void) dup(pipein[0]);
- + #endif
- (void) close(pipein[0]);
- (void) close(pipein[1]);
- }
- else if ((flags & F_NOINTERRUPT) && tpgrp == -1) {
- + #ifdef __MINT__
- + int fd = open(_PATH_DEVNULL, O_RDONLY);
- + (void) dup2(fd, 0);
- + (void) close(fd);
- + #else
- (void) close(0);
- (void) open(_PATH_DEVNULL, O_RDONLY);
- + #endif
- }
- else {
- + #ifdef __MINT__
- + (void) dup2(OLDSTD, 0);
- + #else
- (void) close(0);
- (void) dup(OLDSTD);
- + #endif
- #ifdef FIONCLEX
- # ifdef CLEX_DUPS
- /*
- ***************
- *** 863,875 ****
- --- 890,910 ----
- is1atty = isatty(1);
- }
- else if (flags & F_PIPEOUT) {
- + #ifdef __MINT__
- + (void) dup2(pipeout[1], 1);
- + #else
- (void) close(1);
- (void) dup(pipeout[1]);
- + #endif
- is1atty = 0;
- }
- else {
- + #ifdef __MINT__
- + (void) dup2(SHOUT, 1);
- + #else
- (void) close(1);
- (void) dup(SHOUT);
- + #endif
- is1atty = isoutatty;
- #ifdef FIONCLEX
- # ifdef CLEX_DUPS
- ***************
- *** 880,890 ****
- --- 915,933 ----
-
- (void) close(2);
- if (flags & F_STDERR) {
- + #ifdef __MINT__
- + (void) dup2(1, 2);
- + #else
- (void) dup(1);
- + #endif
- is2atty = is1atty;
- }
- else {
- + #ifdef __MINT__
- + (void) dup2(SHDIAG, 2);
- + #else
- (void) dup(SHDIAG);
- + #endif
- is2atty = isdiagatty;
- #ifdef FIONCLEX
- # ifdef CLEX_DUPS
- diff --context --new-file --recursive ../tcsh-6.02/sh.set.c ./sh.set.c
- *** ../tcsh-6.02/sh.set.c Wed May 20 04:00:42 1992
- --- ./sh.set.c Sun Feb 21 01:39:06 1993
- ***************
- *** 53,58 ****
- --- 53,61 ----
- static struct varent *madrof __P((Char *, struct varent *));
- static void unsetv1 __P((struct varent *));
- static void exportpath __P((Char **));
- + #ifdef __MINT__
- + static void exportsuffixes __P((Char **));
- + #endif
- static void balance __P((struct varent *, int, int));
-
- /*
- ***************
- *** 132,137 ****
- --- 135,146 ----
- exportpath(adrof(STRpath)->vec);
- dohash(NULL, NULL);
- }
- + #ifdef __MINT__
- + else if (eq(vp, STRsuffixes)) {
- + exportsuffixes(adrof(STRsuffixes)->vec);
- + dohash(NULL, NULL);
- + }
- + #endif
- else if (eq(vp, STRhistchars)) {
- register Char *pn = value(vp);
-
- ***************
- *** 335,340 ****
- --- 344,355 ----
- exportpath(adrof(STRpath)->vec);
- dohash(NULL, NULL);
- }
- + #ifdef __MINT__
- + else if (eq(vp, STRsuffixes)) {
- + exportsuffixes(adrof(STRsuffixes)->vec);
- + dohash(NULL, NULL);
- + }
- + #endif
- xfree((ptr_t) vp);
- if (c != '=')
- xfree((ptr_t) p);
- ***************
- *** 407,413 ****
- }
- else {
- num = 4; /* confuse lint */
- ! if (sizeof(int) == num && ((unsigned int) n) == 2147483648) {
- *putp++ = '2';
- n = 147483648;
- }
- --- 422,428 ----
- }
- else {
- num = 4; /* confuse lint */
- ! if (sizeof(int) == num && ((unsigned int) n) == 2147483648U) {
- *putp++ = '2';
- n = 147483648;
- }
- ***************
- *** 717,722 ****
- --- 732,761 ----
- Setenv(STRPATH, exppath);
- }
-
- + #ifdef __MINT__
- + static void
- + exportsuffixes(val)
- + Char **val;
- + {
- + Char expsuff[BUFSIZE];
- + static Char STRcomma[] = { ',' , '\0' };
- +
- + expsuff[0] = 0;
- + if (val)
- + while (*val) {
- + if (Strlen(*val) + Strlen(expsuff) + 2 > BUFSIZE) {
- + xprintf("Warning: ridiculously long SUFFIXES truncated\n");
- + break;
- + }
- + (void) Strcat(expsuff, *val++);
- + if (*val == 0 || eq(*val, STRRparen))
- + break;
- + (void) Strcat(expsuff, STRcomma);
- + }
- + Setenv(STRSUFFIXES, expsuff);
- + }
- + #endif /* __MINT__ */
- +
- #ifndef lint
- /*
- * Lint thinks these have null effect
- diff --context --new-file --recursive ../tcsh-6.02/sh.time.c ./sh.time.c
- *** ../tcsh-6.02/sh.time.c Wed May 20 04:00:42 1992
- --- ./sh.time.c Sun Feb 21 01:39:06 1993
- ***************
- *** 168,173 ****
- --- 168,174 ----
- {
- tvadd(&ru->ru_utime, &ru2->ru_utime);
- tvadd(&ru->ru_stime, &ru2->ru_stime);
- + #ifndef __MINT__
- if (ru2->ru_maxrss > ru->ru_maxrss)
- ru->ru_maxrss = ru2->ru_maxrss;
-
- ***************
- *** 184,189 ****
- --- 185,191 ----
- ru->ru_nsignals += ru2->ru_nsignals;
- ru->ru_nvcsw += ru2->ru_nvcsw;
- ru->ru_nivcsw += ru2->ru_nivcsw;
- + #endif
- }
-
- #else /* BSDTIMES */
- ***************
- *** 313,319 ****
- --- 315,325 ----
- int ms =
- (e->tv_sec - b->tv_sec) * 100 + (e->tv_usec - b->tv_usec) / 10000;
-
- + # ifdef __MINT__
- + cp = "%Uu %Ss %E %P";
- + # else
- cp = "%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww";
- + # endif
- #else
- # ifdef _SEQUENT_
- int ms =
- ***************
- *** 404,410 ****
- xprintf("%ld.%01ld%%", i / 10, i % 10); /* nn.n% */
- break;
-
- ! #ifdef BSDTIMES
- case 'W': /* number of swaps */
- i = r1->ru_nswap - r0->ru_nswap;
- xprintf("%ld", i);
- --- 410,416 ----
- xprintf("%ld.%01ld%%", i / 10, i % 10); /* nn.n% */
- break;
-
- ! #if defined(BSDTIMES) && !defined(__MINT__)
- case 'W': /* number of swaps */
- i = r1->ru_nswap - r0->ru_nswap;
- xprintf("%ld", i);
- diff --context --new-file --recursive ../tcsh-6.02/sh.types.h ./sh.types.h
- *** ../tcsh-6.02/sh.types.h Wed May 20 04:00:50 1992
- --- ./sh.types.h Sun Feb 21 01:39:38 1993
- ***************
- *** 402,407 ****
- --- 402,416 ----
- # endif /* __SIZE_T && !_SIZE_T */
- #endif /* convex || __convex__ */
-
- + /*
- + * MiNT
- + */
- + #ifdef __MINT__
- + # define _SIGMASK_T
- + typedef long sigmask_t;
- + #endif
- +
- +
- /***
- *** Catch all for non POSIX and/or non ANSI systems.
- *** Systems up to spec *should* define these automatically
- diff --context --new-file --recursive ../tcsh-6.02/tc.alloc.c ./tc.alloc.c
- *** ../tcsh-6.02/tc.alloc.c Wed May 20 04:00:48 1992
- --- ./tc.alloc.c Sun Feb 21 01:39:30 1993
- ***************
- *** 46,51 ****
- --- 46,58 ----
-
- RCSID("$Id: tc.alloc.c,v 3.12 1992/05/02 23:39:58 christos Exp $")
-
- + #ifdef __MINT__
- + /* need large stack because we alloc from stack (cause tcsh assumes
- + * continuus memory which MiNT does not provide)
- + */
- + long _stksize = -128*1024L;
- + #endif
- +
- static char *memtop = NULL; /* PWP: top of current memory */
- static char *membot = NULL; /* PWP: bottom of allocatable memory */
-
- ***************
- *** 240,249 ****
- --- 247,259 ----
- memtop = (char *) op;
- if (membot == NULL)
- membot = memtop;
- +
- + #ifndef __MINT__
- if ((int) op & 0x3ff) {
- memtop = (char *) sbrk(1024 - ((int) op & 0x3ff));
- memtop += 1024 - ((int) op & 0x3ff);
- }
- + #endif
-
- /* take 2k unless the block is bigger than that */
- rnu = (bucket <= 8) ? 11 : bucket + 3;
- diff --context --new-file --recursive ../tcsh-6.02/tc.const.c ./tc.const.c
- *** ../tcsh-6.02/tc.const.c Wed May 20 04:00:48 1992
- --- ./tc.const.c Sun Feb 21 01:39:32 1993
- ***************
- *** 77,101 ****
- --- 77,127 ----
- Char STRhistfile[] = { 'h', 'i', 's', 't', 'f', 'i', 'l', 'e', '\0' };
- Char STRsource[] = { 's', 'o', 'u', 'r', 'c', 'e', '\0' };
- Char STRmh[] = { '-', 'h', '\0' };
- + #ifndef DOSFS
- Char STRtildothist[] = { '~', '/', '.', 'h', 'i', 's', 't', 'o', 'r',
- 'y', '\0' };
- + #else
- + Char STRtildothist[] = { '~', '/', 'h', 'i', 's', 't', 'o', 'r', 'y',
- + '.', 'c', 's', 'h', '\0' };
- + #endif
-
- #ifdef KANJI
- Char STRnokanji[] = { 'n', 'o', 'k', 'a', 'n', 'j', 'i', '\0' };
- #endif
-
- #ifdef CSHDIRS
- + # ifndef DOSFS
- Char STRdirfile[] = { '~', '/', '.', 'c', 's', 'h', 'd', 'i', 'r',
- 's', '\0' };
- Char STRsldtdirs[] = { '/', '.', 'c', 's', 'h', 'd', 'i', 'r', 's', '\0' };
- + # else
- + Char STRdirfile[] = { '~', '/', 'c', 's', 'h', 'd', 'i', 'r', 's',
- + '.', 'c', 's', 'h', '\0' };
- + Char STRsldtdirs[] = { '/', 'c', 's', 'h', 'd', 'i', 'r', 's', '.',
- + 'c', 's', 'h', '\0' };
- + # endif
- Char STRsavedirs[] = { 's', 'a', 'v', 'e', 'd', 'i', 'r', 's', '\0' };
- #endif
-
- Char STRargv[] = { 'a', 'r', 'g', 'v', '\0' };
- Char STRsavehist[] = { 's', 'a', 'v', 'e', 'h', 'i', 's', 't', '\0' };
- +
- + #ifndef DOSFS
- Char STRsldthist[] = { '/', '.', 'h', 'i', 's', 't', 'o', 'r', 'y', '\0' };
- + #else
- + Char STRsldthist[] = { '/', 'h', 'i', 's', 't', 'o', 'r', 'y', '.',
- + 'c', 's', 'h', '\0' };
- + #endif
- +
- Char STRnormal[] = { 'n', 'o', 'r', 'm', 'a', 'l', '\0' };
- +
- + #ifndef DOSFS
- Char STRsldtlogout[] = { '/', '.', 'l', 'o', 'g', 'o', 'u', 't', '\0' };
- + #else
- + Char STRsldtlogout[] = { '/', 'l', 'o', 'g', 'o', 'u', 't', '.', 'c', 's',
- + 'h', '\0' };
- + #endif
- +
- Char STRjobs[] = { 'j', 'o', 'b', 's', '\0' };
- Char STRsymhash[] = { '#', ' ', '\0' };
- Char STRsymarrow[] = { '>', ' ', '\0' };
- ***************
- *** 197,205 ****
- --- 223,241 ----
- Char STRmail[] = { 'm', 'a', 'i', 'l', '\0' };
- Char STRwatch[] = { 'w', 'a', 't', 'c', 'h', '\0' };
-
- + #ifndef DOSFS
- Char STRsldottcshrc[] = { '/', '.', 't', 'c', 's', 'h', 'r', 'c', '\0' };
- Char STRsldotcshrc[] = { '/', '.', 'c', 's', 'h', 'r', 'c', '\0' };
- Char STRsldotlogin[] = { '/', '.', 'l', 'o', 'g', 'i', 'n', '\0' };
- + #else
- + Char STRsldottcshrc[] = { '/', 't', 'c', 's', 'h', 'r', 'c', '.', 'c',
- + 's', 'h', '\0' };
- + Char STRsldotcshrc[] = { '/', 'c', 's', 'h', 'r', 'c', '.', 'c', 's',
- + 'h', '\0' };
- + Char STRsldotlogin[] = { '/', 'l', 'o', 'g', 'i', 'n', '.', 'c', 's',
- + 'h', '\0' };
- + #endif
- +
- Char STRignoreeof[] = { 'i', 'g', 'n', 'o', 'r', 'e', 'e', 'o', 'f', '\0' };
- Char STRnoclobber[] = { 'n', 'o', 'c', 'l', 'o', 'b', 'b', 'e', 'r', '\0' };
- Char STRhelpcommand[] = { 'h', 'e', 'l', 'p', 'c', 'o', 'm', 'm', 'a', 'n',
- ***************
- *** 270,272 ****
- --- 306,313 ----
- Char STRsys53[] = { 's', 'y', 's', '5', '.', '3', '\0' };
- Char STRver[] = { 'v', 'e', 'r', '\0' };
- #endif /* apollo */
- +
- + #ifdef __MINT__
- + Char STRsuffixes[] = { 's', 'u', 'f', 'f', 'i', 'x', 'e', 's', '\0' };
- + Char STRSUFFIXES[] = { 'S', 'U', 'F', 'F', 'I', 'X', 'E', 'S', '\0' };
- + #endif
- diff --context --new-file --recursive ../tcsh-6.02/tc.func.c ./tc.func.c
- *** ../tcsh-6.02/tc.func.c Wed May 20 04:00:48 1992
- --- ./tc.func.c Sun Feb 21 01:39:34 1993
- ***************
- *** 277,283 ****
- tmp = dnormalize(v[k], symlinks == SYM_IGNORE ||
- symlinks == SYM_EXPAND);
- dp = &tmp[Strlen(tmp) - 1];
- ! if (*dp == '/' && dp != tmp)
- #ifdef apollo
- if (dp != &tmp[1])
- #endif /* apollo */
- --- 277,283 ----
- tmp = dnormalize(v[k], symlinks == SYM_IGNORE ||
- symlinks == SYM_EXPAND);
- dp = &tmp[Strlen(tmp) - 1];
- ! if (is_dirsep(*dp) && dp != tmp)
- #ifdef apollo
- if (dp != &tmp[1])
- #endif /* apollo */
- ***************
- *** 304,310 ****
- --- 304,314 ----
- xprintf("%s:\n", short2str(tmp));
- for (cp = tmp, dp = buf; *cp; *dp++ = (*cp++ | QUOTE))
- continue;
- + #if 0
- if (dp[-1] != (Char) ('/' | QUOTE))
- + #else
- + if (! ((dp[-1] & QUOTE) && is_dirsep(dp[-1] & ~QUOTE)))
- + #endif
- *dp++ = '/';
- else
- dp[-1] &= TRIM;
- ***************
- *** 423,436 ****
- int epl, vpl;
-
- if ((ep = getenv("EDITOR")) != NULL) { /* if we have a value */
- ! if ((p = strrchr(ep, '/')) != NULL) /* if it has a path */
- ep = p + 1; /* then we want only the last part */
- }
- else
- ep = "ed";
-
- if ((vp = getenv("VISUAL")) != NULL) { /* if we have a value */
- ! if ((p = strrchr(vp, '/')) != NULL) /* and it has a path */
- vp = p + 1; /* then we want only the last part */
- }
- else
- --- 427,440 ----
- int epl, vpl;
-
- if ((ep = getenv("EDITOR")) != NULL) { /* if we have a value */
- ! if ((p = lastslash(ep)) != NULL) /* if it has a path */
- ep = p + 1; /* then we want only the last part */
- }
- else
- ep = "ed";
-
- if ((vp = getenv("VISUAL")) != NULL) { /* if we have a value */
- ! if ((p = lastslash(vp)) != NULL) /* and it has a path */
- vp = p + 1; /* then we want only the last part */
- }
- else
- ***************
- *** 450,456 ****
- continue;
- *cp = '\0';
-
- ! if ((cp = strrchr(p, '/')) != NULL) /* and it has a path */
- cp = cp + 1; /* then we want only the last part */
- else
- cp = p; /* else we get all of it */
- --- 454,460 ----
- continue;
- *cp = '\0';
-
- ! if ((cp = lastslash(p)) != NULL) /* and it has a path */
- cp = cp + 1; /* then we want only the last part */
- else
- cp = p; /* else we get all of it */
- ***************
- *** 1393,1405 ****
- }
- if (((h = value(STRhome)) != NULL) &&
- (Strncmp(p = *hm, h, j = Strlen(h)) == 0) &&
- ! (p[j] == '/' || p[j] == '\0')) {
- *hm = &p[j];
- return STRNULL;
- }
- for (i = 0; i < tlength; i++)
- if ((Strncmp(p = *hm, tcache[i].home, j = tcache[i].hlen) == 0) &&
- ! (p[j] == '/' || p[j] == '\0')) {
- *hm = &p[j];
- return tcache[i].user;
- }
- --- 1397,1409 ----
- }
- if (((h = value(STRhome)) != NULL) &&
- (Strncmp(p = *hm, h, j = Strlen(h)) == 0) &&
- ! (is_dirsep(p[j]) || p[j] == '\0')) {
- *hm = &p[j];
- return STRNULL;
- }
- for (i = 0; i < tlength; i++)
- if ((Strncmp(p = *hm, tcache[i].home, j = tcache[i].hlen) == 0) &&
- ! (is_dirsep(p[j]) || p[j] == '\0')) {
- *hm = &p[j];
- return tcache[i].user;
- }
- ***************
- *** 1459,1466 ****
- --- 1463,1478 ----
-
- if ((n = read(fd, tbuf, BUFSIZE)) <= 0)
- goto eof;
- + #ifdef DOSTEXT
- + /* we probably should strip the carriage returns, but
- + * changing them to blanks will work just as well for most cases
- + */
- + for (i = 0; i < n; i++)
- + buf[i] = (tbuf[i] == '\r') ? ' ' : tbuf[i];
- + #else
- for (i = 0; i < n; i++)
- buf[i] = tbuf[i];
- + #endif
- p = buf;
- }
- n--;
- diff --context --new-file --recursive ../tcsh-6.02/tc.os.c ./tc.os.c
- *** ../tcsh-6.02/tc.os.c Wed May 20 04:00:50 1992
- --- ./tc.os.c Sun Feb 21 01:39:28 1993
- ***************
- *** 943,949 ****
- /* look if we found root yet */
- if (st_cur.st_ino == st_root.st_ino &&
- DEV_DEV_COMPARE(st_cur.st_dev, st_root.st_dev)) {
- ! (void) strcpy(pathname, *pathptr != '/' ? "/" : pathptr);
- return (pathname);
- }
-
- --- 943,949 ----
- /* look if we found root yet */
- if (st_cur.st_ino == st_root.st_ino &&
- DEV_DEV_COMPARE(st_cur.st_dev, st_root.st_dev)) {
- ! (void) strcpy(pathname, (! is_dirsep(*pathptr)) ? "/" : pathptr);
- return (pathname);
- }
-
- diff --context --new-file --recursive ../tcsh-6.02/tc.os.h ./tc.os.h
- *** ../tcsh-6.02/tc.os.h Wed May 20 04:00:50 1992
- --- ./tc.os.h Sun Feb 21 01:39:34 1993
- ***************
- *** 375,380 ****
- --- 375,381 ----
- extern int atoi();
- extern char *ttyname();
-
- + #ifndef __MINT__
- # ifndef hpux
- # if __GNUC__ != 2
- extern int abort();
- ***************
- *** 386,391 ****
- --- 387,393 ----
- extern void abort();
- extern void qsort();
- # endif
- + #endif /* __MINT__ */
- extern void perror();
-
- #ifndef NEEDgethostname
- diff --context --new-file --recursive ../tcsh-6.02/tc.prompt.c ./tc.prompt.c
- *** ../tcsh-6.02/tc.prompt.c Wed May 20 04:00:50 1992
- --- ./tc.prompt.c Sun Feb 21 01:39:36 1993
- ***************
- *** 257,263 ****
- else {
- if ((scp != 'C') && (q = value(STRhome)) &&
- Strncmp(buff, q, (k = Strlen(q))) == 0 &&
- ! (buff[k] == '/' || buff[k] == '\0')) {
- buff[--k] = '~';
- q = &buff[k];
- }
- --- 257,263 ----
- else {
- if ((scp != 'C') && (q = value(STRhome)) &&
- Strncmp(buff, q, (k = Strlen(q))) == 0 &&
- ! (is_dirsep(buff[k]) || buff[k] == '\0')) {
- buff[--k] = '~';
- q = &buff[k];
- }
- ***************
- *** 266,277 ****
- for (z = q; *z; z++)
- continue; /* find the end */
- while (j-- > 0) {
- ! while ((z > q) && (*z != '/'))
- z--; /* back up */
- if (j && z > q)
- z--;
- }
- ! if (*z == '/' && z != q)
- z++;
- while (*z) {
- *p++ = attributes | *z++;
- --- 266,277 ----
- for (z = q; *z; z++)
- continue; /* find the end */
- while (j-- > 0) {
- ! while ((z > q) && (! is_dirsep(*z)))
- z--; /* back up */
- if (j && z > q)
- z--;
- }
- ! if (is_dirsep(*z) && z != q)
- z++;
- while (*z) {
- *p++ = attributes | *z++;
- diff --context --new-file --recursive ../tcsh-6.02/tc.sig.c ./tc.sig.c
- *** ../tcsh-6.02/tc.sig.c Wed May 20 04:00:50 1992
- --- ./tc.sig.c Sun Feb 21 01:39:36 1993
- ***************
- *** 416,418 ****
- --- 416,439 ----
- Synch_Cnt++;
- }
- #endif /* SIGSYNCH */
- +
- + #ifdef __MINT__
- + /* MiNT has most BSD signal things, but not sigvec; punt */
- + void
- + mysigvec(sig, new, old)
- + int sig;
- + sigvec_t *new, *old;
- + {
- + void (*oldhandler)();
- +
- + if (new) {
- + oldhandler = signal(sig, new->sv_handler);
- + } else {
- + oldhandler = signal(sig, SIG_IGN);
- + signal(sig, oldhandler);
- + }
- + if (old)
- + old->sv_handler = oldhandler;
- + }
- + #endif /* __MINT__ */
- +
- diff --context --new-file --recursive ../tcsh-6.02/tc.sig.h ./tc.sig.h
- *** ../tcsh-6.02/tc.sig.h Wed May 20 04:00:50 1992
- --- ./tc.sig.h Sun Feb 21 01:39:38 1993
- ***************
- *** 77,82 ****
- --- 77,90 ----
- # define NEEDsignal
- # endif /* hpux */
-
- + # ifdef __MINT__
- + # define HAVE_SIGVEC
- + typedef struct sigvec {
- + sigret_t (*sv_handler)();
- + } sigvec_t;
- + extern void mysigvec __P((int, sigvec_t *, sigvec_t *));
- + #endif /* __MINT__ */
- +
- # ifndef HAVE_SIGVEC
- # define mysigvec(a, b, c) sigvec(a, b, c)
- typedef struct sigvec sigvec_t;
- ***************
- *** 120,129 ****
- --- 128,139 ----
- /*
- * For 4.2bsd signals.
- */
- + # ifndef __MINT__
- # ifdef sigmask
- # undef sigmask
- # endif /* sigmask */
- # define sigmask(s) (1 << ((s)-1))
- + # endif /* __MINT__ */
- # ifdef _SEQUENT_
- # define sigpause(a) bsd_sigpause(a)
- # define signal(a, b) bsd_signal(a, b)
- diff --context --new-file --recursive ../tcsh-6.02/tw.init.c ./tw.init.c
- *** ../tcsh-6.02/tw.init.c Wed May 20 04:00:44 1992
- --- ./tw.init.c Sun Feb 21 01:39:14 1993
- ***************
- *** 248,259 ****
- struct varent *v = adrof(STRpath);
- struct varent *recexec = adrof(STRrecognize_only_executables);
-
-
- if (v == NULL) /* if no path */
- return;
-
- for (pv = v->vec; *pv; pv++) {
- ! if (pv[0][0] != '/') {
- tw_cmd_got |= TW_FL_REL;
- continue;
- }
- --- 248,263 ----
- struct varent *v = adrof(STRpath);
- struct varent *recexec = adrof(STRrecognize_only_executables);
-
- + #ifdef __MINT__
- + struct varent *suffv = adrof(STRsuffixes);
- + Char **suffpv;
- + #endif
-
- if (v == NULL) /* if no path */
- return;
-
- for (pv = v->vec; *pv; pv++) {
- ! if (! is_dirsep(pv[0][0])) {
- tw_cmd_got |= TW_FL_REL;
- continue;
- }
- ***************
- *** 268,273 ****
- --- 272,291 ----
- name = str2short(dp->d_name);
- if (dp->d_ino == 0 || (recexec && !executable(dir, name, 0)))
- continue;
- +
- + #ifdef __MINT__
- + { char *s = rindex(name, '.');
- +
- + if (s && suffv) {
- + for (suffpv = suffv->vec; *suffpv; suffpv++) {
- + if (!strcmp(s+1, short2str(*suffpv))) {
- + *s = 0; break;
- + }
- + }
- + }
- + }
- + #endif /* __MINT__ */
- +
- tw_cmd_add(name);
- }
- (void) closedir(dirp);
- ***************
- *** 421,427 ****
-
- CLRDIR(tw_cmd_state.dfd)
-
- ! while (*tw_cmd_state.pathv && tw_cmd_state.pathv[0][0] == '/')
- tw_cmd_state.pathv++;
- if ((ptr = *tw_cmd_state.pathv) != 0) {
- /*
- --- 439,445 ----
-
- CLRDIR(tw_cmd_state.dfd)
-
- ! while (*tw_cmd_state.pathv && is_dirsep(tw_cmd_state.pathv[0][0]))
- tw_cmd_state.pathv++;
- if ((ptr = *tw_cmd_state.pathv) != 0) {
- /*
- diff --context --new-file --recursive ../tcsh-6.02/tw.parse.c ./tw.parse.c
- *** ../tcsh-6.02/tw.parse.c Wed May 20 04:00:44 1992
- --- ./tw.parse.c Sun Feb 21 01:39:16 1993
- ***************
- *** 258,264 ****
-
- case RECOGNIZE:
- if (adrof(STRautocorrect)) {
- ! if ((slshp = Strrchr(wordp, '/')) != NULL && slshp[1] != '\0') {
- SearchNoDirErr = 1;
- for (bptr = wordp; bptr < slshp; bptr++) {
- /*
- --- 258,264 ----
-
- case RECOGNIZE:
- if (adrof(STRautocorrect)) {
- ! if ((slshp = Lastslash(word)) != NULL && slshp[1] != '\0') {
- SearchNoDirErr = 1;
- for (bptr = wordp; bptr < slshp; bptr++) {
- /*
- ***************
- *** 341,347 ****
- items[0] = buffer;
- items[1] = NULL;
- ptr = items;
- ! count = (looking == TW_COMMAND && Strchr(wordp, '/') == 0) ?
- c_glob(&ptr) :
- t_glob(&ptr, looking == TW_COMMAND);
- if (count > 0) {
- --- 341,347 ----
- items[0] = buffer;
- items[1] = NULL;
- ptr = items;
- ! count = (looking == TW_COMMAND && Hasslash(wordp) == 0) ?
- c_glob(&ptr) :
- t_glob(&ptr, looking == TW_COMMAND);
- if (count > 0) {
- ***************
- *** 1140,1146 ****
- break;
-
- case TW_COMMAND:
- ! if (Strchr(word, '/')) {
- looking = TW_FILE;
- flags |= TW_EXEC_CHK;
- flags |= TW_DIR_OK;
- --- 1140,1146 ----
- break;
-
- case TW_COMMAND:
- ! if (Hasslash(word)) {
- looking = TW_FILE;
- flags |= TW_EXEC_CHK;
- flags |= TW_DIR_OK;
- ***************
- *** 1175,1186 ****
- */
- flags |= (gpat == 0) ? TW_IGN_OK : TW_PAT_OK;
-
- ! if ((*word == '~') && (Strchr(word, '/') == NULL)) {
- looking = TW_LOGNAME;
- target = name;
- }
- else if ((target = Strrchr(name, '$')) != 0 &&
- ! (Strchr(name, '/') == NULL)) {
- target++;
- looking = TW_VARIABLE;
- }
- --- 1175,1186 ----
- */
- flags |= (gpat == 0) ? TW_IGN_OK : TW_PAT_OK;
-
- ! if ((*word == '~') && (Hasslash(word) == NULL)) {
- looking = TW_LOGNAME;
- target = name;
- }
- else if ((target = Strrchr(name, '$')) != 0 &&
- ! (Hasslash(name) == NULL)) {
- target++;
- looking = TW_VARIABLE;
- }
- ***************
- *** 1232,1242 ****
- if (isadirectory(exp_dir, name)) {
- if (exp_dir[0] != '\0' || name[0] != '\0') {
- catn(dir, name, MAXNAMLEN);
- ! if (dir[Strlen(dir) - 1] != '/')
- catn(dir, STRslash, MAXNAMLEN);
- if ((nd = expand_dir(dir, exp_dir, &dir_fd, command)) != 0)
- return nd;
- ! if (word[Strlen(word) - 1] != '/')
- catn(word, STRslash, MAXNAMLEN);
- name[0] = '\0';
- }
- --- 1232,1242 ----
- if (isadirectory(exp_dir, name)) {
- if (exp_dir[0] != '\0' || name[0] != '\0') {
- catn(dir, name, MAXNAMLEN);
- ! if (! is_dirsep(dir[Strlen(dir) - 1])))
- catn(dir, STRslash, MAXNAMLEN);
- if ((nd = expand_dir(dir, exp_dir, &dir_fd, command)) != 0)
- return nd;
- ! if (! is_dirsep(word[Strlen(word) - 1]))
- catn(word, STRslash, MAXNAMLEN);
- name[0] = '\0';
- }
- ***************
- *** 1342,1348 ****
- {
- register Char *p;
-
- ! p = Strrchr(path, '/');
- if (p == NULL) {
- copyn(name, path, MAXNAMLEN);
- dir[0] = '\0';
- --- 1342,1348 ----
- {
- register Char *p;
-
- ! p = Lastslash(path);
- if (p == NULL) {
- copyn(name, path, MAXNAMLEN);
- dir[0] = '\0';
- ***************
- *** 1417,1423 ****
-
- switch (old[0]) {
- case '~':
- ! for (p = new, o = &old[1]; *o && *o != '/'; *p++ = *o++)
- continue;
- *p = '\0';
- if (gethdir(new)) {
- --- 1417,1423 ----
-
- switch (old[0]) {
- case '~':
- ! for (p = new, o = &old[1]; *o && (! is_dirsep(*o)); *p++ = *o++)
- continue;
- *p = '\0';
- if (gethdir(new)) {
- ***************
- *** 1485,1494 ****
- */
- for (p = edir; *p; p++)
- continue;
- ! if (*--p == '/') {
- for (p = nd; *p; p++)
- continue;
- ! if (*--p != '/')
- p = NULL;
- }
- for (d = edir, s = nd; (*d++ = *s++) != '\0';)
- --- 1485,1494 ----
- */
- for (p = edir; *p; p++)
- continue;
- ! if (is_dirsep(*--p)) {
- for (p = nd; *p; p++)
- continue;
- ! if (! is_dirsep(*--p))
- p = NULL;
- }
- for (d = edir, s = nd; (*d++ = *s++) != '\0';)
- diff --context --new-file --recursive ../tcsh-6.02/tw.spell.c ./tw.spell.c
- *** ../tcsh-6.02/tw.spell.c Wed May 20 04:00:44 1992
- --- ./tw.spell.c Sun Feb 21 01:39:16 1993
- ***************
- *** 53,60 ****
- bool foundslash = 0;
- int retval;
-
- for (;;) {
- ! while (*old == '/') { /* skip '/' */
- *new++ = *old++;
- foundslash = 1;
- }
- --- 53,67 ----
- bool foundslash = 0;
- int retval;
-
- + #ifdef DOSFS
- + /* skip drive specification, if any */
- + if (*old && old[1] == ':' && is_dirsep(old[2])) {
- + *new++ = *old++; *new++ = *old++;
- + }
- + #endif
- +
- for (;;) {
- ! while (is_dirsep(*old)) { /* skip '/' */
- *new++ = *old++;
- foundslash = 1;
- }
- ***************
- *** 73,79 ****
- if (p < guess + FILSIZ)
- *p++ = *cp;
- ws = p;
- ! for (; *old != '/' && *old != '\0'; old++)/* add current file name */
- if (p < guess + FILSIZ)
- *p++ = *old;
- *p = '\0'; /* terminate it */
- --- 80,86 ----
- if (p < guess + FILSIZ)
- *p++ = *cp;
- ws = p;
- ! for (; (! is_dirsep(*old)) && *old != '\0'; old++)/* add current file name */
- if (p < guess + FILSIZ)
- *p++ = *old;
- *p = '\0'; /* terminate it */
- ***************
- *** 84,90 ****
- */
- /* (*should* say "looking for directory" whenever '/' is next...) */
- retval = t_search(guess, p, SPELL, FILSIZ,
- ! looking_for_cmd && (foundslash || *old != '/') ?
- TW_COMMAND : TW_ZERO, 1, STRNULL, 0);
- if (retval >= 4 || retval < 0)
- return -1; /* hopeless */
- --- 91,97 ----
- */
- /* (*should* say "looking for directory" whenever '/' is next...) */
- retval = t_search(guess, p, SPELL, FILSIZ,
- ! looking_for_cmd && (foundslash || (! is_dirsep(*old))) ?
- TW_COMMAND : TW_ZERO, 1, STRNULL, 0);
- if (retval >= 4 || retval < 0)
- return -1; /* hopeless */
-